package com.zat.mes.andrmes.dofun.work.adapter

import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.DayPlanProduceBeanItem
import com.zat.mes.andrmes.data.MotorWorkRecordBean
import com.zat.mes.andrmes.data.ProgramSchedulingDetail
import com.zat.mes.andrmes.utils.SpannableStrUtil
import kotlinx.android.synthetic.main.item_item_proc_day_produce_plan.view.*

/**
 * @author xyan
 * @date :2023-07-19
 * @description:
 */
class MotorWorkRecordAdapter(layoutResId: Int) :
    BaseQuickAdapter<MotorWorkRecordBean, BaseViewHolder>(layoutResId) {
    var selectedIndex=-1;

    override fun convert(helper: BaseViewHolder, item: MotorWorkRecordBean) {
//        helper.setText(R.id.materialNameTV, item.materialName)
//        helper.setText(R.id.lotNoTV, item.lotNo)
//        helper.setText(R.id.qtyTV,if (item.qty!=null) item.qty.toString()else "")

        helper.setVisible(R.id.checkbox,true).setText(R.id.expectDateTV,item.expectDate.replace("00:00:00","")).setText(R.id.orderNoTV,item.orderNo).setText(R.id.colorSizeTV,item.color+""+item.size).setText(R.id.qtyTV,(item.qty-item.producedQty).toString())
        helper.getView<CheckBox>(R.id.checkbox).isChecked = helper.layoutPosition==selectedIndex
    }
}

